package com.tgy.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/***
 * @ClassName: getContextParma
 * @Description: 得到初始化数据
 * @Auther: 送一一块二向箔
 * @Date: 11:19 2021/12/4
 * @version : V1.0
 */
public class GetContextParma extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取上下文对象
        ServletContext context = this.getServletContext();
        //获取初始参数
        String url = context.getInitParameter("url");

        System.out.println("url: "+url);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
